package org.example.weather.bigscreen.core.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.weather.bigscreen.core.api.AreaApi;
import org.example.weather.bigscreen.core.api.dto.AreaDTO;
import org.example.weather.bigscreen.core.service.AreaService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created on 2022-07-22.
 *
 * @author chenyu
 */
@RestController
@Slf4j
@RequestMapping("area")
public class AreaController implements AreaApi {
    private AreaService areaService;

    public AreaController(final AreaService areaService) {
        this.areaService = areaService;
    }

    @Override
    public AreaDTO selectById(String areaId) {

        return areaService.selectById(areaId);
    }

    @Override
    public List<AreaDTO> selectByIds(List<String> areaIds) {

        return areaService.selectByIds(areaIds);
    }

    @Override
    public AreaDTO selectParent(String areaId) {

        return areaService.selectParent(areaId);
    }

    @Override
    public List<AreaDTO> selectAncestors(String areaId) {

        return areaService.selectAncestors(areaId);
    }

    @Override
    public  AreaDTO  selectAncestor(String areaId, Integer level) {

        return areaService.selectAncestor(areaId,level);
    }

    @Override
    public List<AreaDTO> selectByParentId(String parentId) {

        return areaService.selectByParentId(parentId);
    }

    @Override
    public List<AreaDTO> selectDescendants(String parentId) {

        return areaService.selectDescendants(parentId);
    }

    @Override
    public List<AreaDTO> selectByLevel(Integer level) {

        return areaService.selectByLevel(level);
    }

    @Override
    public List<AreaDTO> selectAll() {

        return areaService.selectAll();
    }


}
